package com.atguigu.service;

import com.atguigu.bean.Book;
import org.springframework.amqp.core.Message;
import org.springframework.stereotype.Service;

@Service
public class BookService {
    // 监听消息
    // @RabbitListener(queues = "gulixueyuan.news")
    public void receive(Book book) {
        System.out.println("收到消息：" + book);
    }

    // @RabbitListener(queues = "atguigu")
    public void receive(Message message) {
        System.out.println(message.getBody());
        System.out.println(message.getMessageProperties());
    }
}
